// package il.ac.mta.javaweb.ex1.tests;
//
// import static org.junit.Assert.assertEquals;
// import il.ac.mta.javaweb.ex1.logic.BattleShip;
// import il.ac.mta.javaweb.ex1.logic.ShipDirection;
// import il.ac.mta.javaweb.ex1.logic.grids.BattleShipsGrid;
//
// import java.awt.Point;
//
// import org.junit.Test;
//
// public class TestBattleShipGrid
// {
// // Test legal positions
// @Test
// public void SetLegalPositionHorizonotalTopLeftCorner()
// {
// BattleShipsGrid grid = new BattleShipsGrid();
// BattleShip ship = new BattleShip(3, new Point(0, 0),
// ShipDirection.HORIZONTAL);
//
// assertEquals(true, grid.trySetShip(ship));
// }
//
// @Test
// public void SetLegalPositionHorizonotalBottomLeftCorner()
// {
// BattleShipsGrid grid = new BattleShipsGrid();
// BattleShip ship = new BattleShip(3, new Point(0, 9),
// ShipDirection.HORIZONTAL);
//
// assertEquals(true, grid.trySetShip(ship));
// }
//
// @Test
// public void SetLegalPositionHorizonotalTopRighCorner()
// {
// BattleShipsGrid grid = new BattleShipsGrid();
// BattleShip ship = new BattleShip(3, new Point(7, 0),
// ShipDirection.HORIZONTAL);
//
// assertEquals(true, grid.trySetShip(ship));
// }
//
// @Test
// public void SetLegalPositionHorizonotalBottomRightCorner()
// {
// BattleShipsGrid grid = new BattleShipsGrid();
// BattleShip ship = new BattleShip(3, new Point(7, 9),
// ShipDirection.HORIZONTAL);
//
// assertEquals(true, grid.trySetShip(ship));
// }
//
// @Test
// public void SetLegalPositionVerticalTopLeftCorner()
// {
// BattleShipsGrid grid = new BattleShipsGrid();
// BattleShip ship = new BattleShip(3, new Point(0, 0), ShipDirection.VERTICAL);
//
// assertEquals(true, grid.trySetShip(ship));
// }
//
// @Test
// public void SetLegalPositionVerticalBottomLeftCorner()
// {
// BattleShipsGrid grid = new BattleShipsGrid();
// BattleShip ship = new BattleShip(3, new Point(0, 7), ShipDirection.VERTICAL);
//
// assertEquals(true, grid.trySetShip(ship));
// }
//
// @Test
// public void SetLegalPositionVerticalTopRighCorner()
// {
// BattleShipsGrid grid = new BattleShipsGrid();
// BattleShip ship = new BattleShip(3, new Point(9, 0), ShipDirection.VERTICAL);
//
// assertEquals(true, grid.trySetShip(ship));
// }
//
// @Test
// public void SetLegalPositionVerticalBottomRightCorner()
// {
// BattleShipsGrid grid = new BattleShipsGrid();
// BattleShip ship = new BattleShip(3, new Point(9, 7), ShipDirection.VERTICAL);
//
// assertEquals(true, grid.trySetShip(ship));
// }
//
// // Test illegal positions
// @Test
// public void SetIlegalPositionHorizonotalTopLeftCorner()
// {
// BattleShipsGrid grid = new BattleShipsGrid();
// BattleShip ship = new BattleShip(3, new Point(-1, 0),
// ShipDirection.HORIZONTAL);
//
// assertEquals(false, grid.trySetShip(ship));
// }
//
// @Test
// public void SetIlegalPositionHorizonotalBottomLeftCorner()
// {
// BattleShipsGrid grid = new BattleShipsGrid();
// BattleShip ship = new BattleShip(3, new Point(-1, 9),
// ShipDirection.HORIZONTAL);
//
// assertEquals(false, grid.trySetShip(ship));
// }
//
// @Test
// public void SetIlegalPositionHorizonotalTopRighCorner()
// {
// BattleShipsGrid grid = new BattleShipsGrid();
// BattleShip ship = new BattleShip(3, new Point(8, 0),
// ShipDirection.HORIZONTAL);
//
// assertEquals(false, grid.trySetShip(ship));
// }
//
// @Test
// public void SetIlegalPositionHorizonotalBottomRightCorner()
// {
// BattleShipsGrid grid = new BattleShipsGrid();
// BattleShip ship = new BattleShip(3, new Point(8, 9),
// ShipDirection.HORIZONTAL);
// ;
//
// assertEquals(false, grid.trySetShip(ship));
// }
//
// @Test
// public void SetIlegalPositionVerticalTopLeftCorner()
// {
// BattleShipsGrid grid = new BattleShipsGrid();
// BattleShip ship = new BattleShip(3, new Point(0, -1),
// ShipDirection.VERTICAL);
//
// assertEquals(false, grid.trySetShip(ship));
// }
//
// @Test
// public void SetIlegalPositionVerticalBottomLeftCorner()
// {
// BattleShipsGrid grid = new BattleShipsGrid();
// BattleShip ship = new BattleShip(3, new Point(0, 8), ShipDirection.VERTICAL);
//
// assertEquals(false, grid.trySetShip(ship));
// }
//
// @Test
// public void SetIlegalPositionVerticalTopRighCorner()
// {
// BattleShipsGrid grid = new BattleShipsGrid();
// BattleShip ship = new BattleShip(3, new Point(9, -1),
// ShipDirection.VERTICAL);
//
// assertEquals(false, grid.trySetShip(ship));
// }
//
// @Test
// public void SetIlegalPositionVerticalBottomRightCorner()
// {
// BattleShipsGrid grid = new BattleShipsGrid();
// BattleShip ship = new BattleShip(3, new Point(9, 8), ShipDirection.VERTICAL);
//
// assertEquals(false, grid.trySetShip(ship));
// }
//
// // Test lengths
// @Test
// public void SetShipWithLengthZero()
// {
// BattleShipsGrid grid = new BattleShipsGrid();
// BattleShip ship = new BattleShip(0, new Point(0, 0), ShipDirection.VERTICAL);
//
// assertEquals(false, grid.trySetShip(ship));
// }
//
// @Test
// public void SetShipWithLengthSix()
// {
// BattleShipsGrid grid = new BattleShipsGrid();
// BattleShip ship = new BattleShip(6, new Point(0, 0), ShipDirection.VERTICAL);
//
// assertEquals(false, grid.trySetShip(ship));
// }
//
// @Test
// public void SetShipWithLengthThree()
// {
// BattleShipsGrid grid = new BattleShipsGrid();
// BattleShip ship = new BattleShip(3, new Point(0, 0), ShipDirection.VERTICAL);
//
// assertEquals(true, grid.trySetShip(ship));
// }
//
// // Test overlapping
// @Test
// public void SetTwoNonOverlappingShips()
// {
// BattleShipsGrid grid = new BattleShipsGrid();
//
// BattleShip ship1 = new BattleShip(0, new Point(0, 0),
// ShipDirection.HORIZONTAL);
// BattleShip ship2 = new BattleShip(0, new Point(0, 1),
// ShipDirection.VERTICAL);
//
// assertEquals(true, grid.trySetShip(ship1));
// assertEquals(true, grid.trySetShip(ship2));
// }
//
// @Test
// public void SetTwoOverlappingShips()
// {
// BattleShipsGrid grid = new BattleShipsGrid();
//
// BattleShip ship1 = new BattleShip(0, new Point(0, 0),
// ShipDirection.HORIZONTAL);
// BattleShip ship2 = new BattleShip(0, new Point(2, 0),
// ShipDirection.VERTICAL);
//
// assertEquals(true, grid.trySetShip(ship1));
// assertEquals(false, grid.trySetShip(ship2));
// }
//
// // Test several ships of same length of ships
// @Test
// public void SetTwoShipsLengthOfTwo()
// {
// BattleShipsGrid grid = new BattleShipsGrid();
//
// BattleShip ship1 = new BattleShip(0, new Point(0, 2),
// ShipDirection.HORIZONTAL);
// BattleShip ship2 = new BattleShip(0, new Point(3, 2),
// ShipDirection.VERTICAL);
//
// assertEquals(true, grid.trySetShip(ship1));
// assertEquals(false, grid.trySetShip(ship2));
// }
//
// @Test
// public void SetThreeShipsLengthOfThree()
// {
// BattleShipsGrid grid = new BattleShipsGrid();
//
// BattleShip ship1 = new BattleShip(3, new Point(0, 0),
// ShipDirection.HORIZONTAL);
// BattleShip ship2 = new BattleShip(0, new Point(0, 1),
// ShipDirection.VERTICAL);
// BattleShip ship3 = new BattleShip(0, new Point(0, 1),
// ShipDirection.VERTICAL);
//
//
// BattleShip ship1 = new BattleShip();
// ship1.setTopLeftPosition(new Point(0, 0));
// ship1.setLength(3);
// ship1.setDirection(ShipDirection.HORIZONTAL);
//
// BattleShip ship2 = new BattleShip();
// ship2.setTopLeftPosition(new Point(0, 2));
// ship2.setLength(3);
// ship2.setDirection(ShipDirection.HORIZONTAL);
//
// BattleShip ship3 = new BattleShip();
// ship3.setTopLeftPosition(new Point(0, 3));
// ship3.setLength(3);
// ship3.setDirection(ShipDirection.HORIZONTAL);
//
// ship1.InitializeSquares();
// ship2.InitializeSquares();
// ship3.InitializeSquares();
//
// assertEquals(true, grid.trySetShip(ship1));
// assertEquals(true, grid.trySetShip(ship2));
// assertEquals(false, grid.trySetShip(ship2));
// }
//
// @Test
// public void SetTwoShipsLengthOfFour()
// {
// BattleShipsGrid grid = new BattleShipsGrid();
//
// BattleShip ship1 = new BattleShip();
// ship1.setTopLeftPosition(new Point(0, 0));
// ship1.setLength(4);
// ship1.setDirection(ShipDirection.HORIZONTAL);
//
// BattleShip ship2 = new BattleShip();
// ship2.setTopLeftPosition(new Point(0, 3));
// ship2.setLength(4);
// ship2.setDirection(ShipDirection.HORIZONTAL);
//
// ship1.InitializeSquares();
// ship2.InitializeSquares();
//
// assertEquals(true, grid.trySetShip(ship1));
// assertEquals(false, grid.trySetShip(ship2));
// }
//
// @Test
// public void SetTwoShipsLengthOfFive()
// {
// BattleShipsGrid grid = new BattleShipsGrid();
//
// BattleShip ship1 = new BattleShip();
// ship1.setTopLeftPosition(new Point(0, 0));
// ship1.setLength(5);
// ship1.setDirection(ShipDirection.HORIZONTAL);
//
// BattleShip ship2 = new BattleShip();
// ship2.setTopLeftPosition(new Point(0, 3));
// ship2.setLength(5);
// ship2.setDirection(ShipDirection.HORIZONTAL);
//
// ship1.InitializeSquares();
// ship2.InitializeSquares();
//
// assertEquals(true, grid.trySetShip(ship1));
// assertEquals(false, grid.trySetShip(ship2));
// }
// }
